import { createRouter, createWebHistory } from 'vue-router';

import Home from '../views/Home.vue';
// 公共组件
import Header from '../components/Header.vue';
import Footer from '../components/Footer.vue'

// 管理员模块
import UserManagement from '../views/Admin/UserManagement.vue';
import JobManagement from '../views/Admin/JobManagement.vue';
import CompanyVerification from '../views/Admin/CompanyVerification.vue';
import ApplicantManagement from '../views/Admin/ApplicantManagement.vue';
import SystemSettings from '../views/Admin/SystemSettings.vue';
import DataStatistics from '../views/Admin/DataStatistics.vue';
import SecurityManagement from '../views/Admin/SecurityManagement.vue';
import AdminHome from "@/views/Admin/AdminHome.vue";
// 求职者模块

import RecommendedPositions from '../views/JobSeeker/RecommendedPositions.vue'
import JobSearch from '../views/JobSeeker/JobSearch.vue';
import Resume from "@/views/JobSeeker/Resume.vue";
import AttachmentResume from '../views/JobSeeker/AttachmentResume.vue'
import ResumeDelivery from "@/views/JobSeeker/ResumeDelivery.vue";

// 企业雇主模块
import EmployerHome from '../views/Employer/EmployerHome.vue';


// 通用登录页面
import Login from '../views/Login.vue';
import Register from '../views/Register.vue';
import PersonalInformation from "@/views/PersonalInformation.vue";
import Chat from "@/views/Chat.vue";
import ChangePassword from "@/views/ChangePassword.vue"


const routes = [
  {
    path: '/',
    name: 'Home',
    components: {
      default: Home,
      header: Header,
      footer: Footer
    }
  },
  {
    path: '/admin/user-management',
    name: 'UserManagement',
    component: UserManagement,
    meta: { requiresAuth: true, role: 'admin' }
  },
  {
    path: '/admin/job-management',
    name: 'JobManagement',
    component: JobManagement,
    meta: { requiresAuth: true, role: 'admin' }
  },
  {
    path: '/admin/company-verification',
    name: 'CompanyVerification',
    component: CompanyVerification,
    meta: { requiresAuth: true, role: 'admin' }
  },
  {
    path: '/admin/applicant-management',
    name: 'ApplicantManagement',
    component: ApplicantManagement,
    meta: { requiresAuth: true, role: 'admin' }
  },
  {
    path: '/admin/system-settings',
    name: 'SystemSettings',
    component: SystemSettings,
    meta: { requiresAuth: true, role: 'admin' }
  },
  {
    path: '/admin/data-statistics',
    name: 'DataStatistics',
    component: DataStatistics,
    meta: { requiresAuth: true, role: 'admin' }
  },
  {
    path: '/admin/security-management',
    name: 'SecurityManagement',
    component: SecurityManagement,
    meta: { requiresAuth: true, role: 'admin' }
  },
  {
    path: '/admin/admin-home',
    name: 'AdminHome',
    component: AdminHome,
    meta: { requiresAuth: true, role: 'admin' }
  },

  {
      path: '/job-seeker/resume-delivery',
      name: 'ResumeDelivery',
      component: ResumeDelivery,
      meta: { requiresAuth: true, role: 'job-seeker' }
    },
  {
    path: '/job-seeker/recommended-positions',
    name: 'RecommendedPositions',
    component: RecommendedPositions,
    meta: { requiresAuth: true, role: 'job-seeker' }
  },
    {
      path: '/job-seeker/resume',
      name: 'Resume',
      component: Resume,
      meta: { requiresAuth: true, role: 'job-seeker' }
    },
  {
    path: '/job-seeker/job-search',
    name: 'JobSearch',
    component: JobSearch,
    meta: { requiresAuth: true, role: 'job-seeker' }
  },
  {
    path: '/job-seeker/attachment-resume',
    name: 'AttachmentResume',
    component: AttachmentResume,
    meta: { requiresAuth: true, role: 'job-seeker' }
  },




  {
    path: '/employer/employer-home',
    name: 'EmployerHome',
    component: EmployerHome,
    meta: { requiresAuth: true, role: 'employer' }
  },

  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/Register',
    name: 'Register',
    component: Register
  }
  ,
    {
      path: '/chat',
      name: 'Chat',
      component: Chat,
      meta: { requiresAuth: true, }
    },
  {
    path: '/personal-information',
    name: 'PersonalInformation',
    component: PersonalInformation,
    meta: { requiresAuth: true, }
  },
    {
      path: '/change-password',
      name: 'ChangePassword',
      component: ChangePassword,
      meta: { requiresAuth: true, }
    },
];
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
});

export default router;
